<template>
  <view>
    <!-- 自定义 search 组件 -->
    <view class="search-container">
      <view class="search-box" @click="gotoSearchPage">
        <!-- icon 图标 -->
        <uni-icons type="search" size="14"></uni-icons>
        <!-- placeholder -->
        <text class="search-title">{{placeholder}}</text>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        // 搜索框的占位符
        placeholder: '想找点啥'
      }
    },
    methods: {
      // 前往搜索页面
      gotoSearchPage() {
        console.log(1);
        uni.navigateTo({
          url: '/subpkg/searchPage/searchPage'
        })
      }
    }
  }
</script>

<style lang="less">
  .search-container {
    height: 50px;
    background-color: #bfa;
    display: flex;
    padding: 0 15px;

    .search-box {
      width: 100%;
      height: 70%;
      border-radius: 50px;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 14px;
      background-color: aliceblue;

      .search-title {
        margin-left: 5px;
      }
    }
  }
</style>
